package org.lilred.nzbberry.util;

public class EscapedString {
	public static String parse(String input) {
		StringBuffer output = new StringBuffer();
		for (int i = 0; i < input.length(); i++) {
			if (input.charAt(i) != '\\') {
				output.append(input.charAt(i));
				//Subtract because we have to add later.
				i--;
			}
			else if (input.charAt(i + 1) == 'n') output.append('\n');
			else if (input.charAt(i + 1) == '"') output.append('"');
			i++;
		}
		return output.toString();
	}
}
